import request from '@/utils/request'

export const getCity = function (level) {
  return request.get('/area/city', { params: { level } })
}
export const getHotCity = function () {
  return request.get('/area/hot')
}
export const rentalUnit = function (area) {
  return request.get('/home/groups', { params: { area } })
}
export const getHouse = function (house) {
  return request.get('/houses', { params: house })
}
export const HouseParticulars = function (id) {
  return request.get(`/houses/${id}`)
}
export const inquireHouse = function (params) {
  return request.get('/area/community', { params })
}
// 判断是否收藏
export const Collect = function (id) {
  return request.get(`/user/favorites/${id}`)
}
// 添加收藏
export const addCollect = function (id) {
  return request.post(`/user/favorites/${id}`)
}
// 删除收藏
export const delCollect = function (id) {
  return request.delete(`/user/favorites/${id}`)
}
// 查看收藏
export const examineCollect = function () {
  return request.get('/user/favorites')
}
// 查看发布房屋需要的条件
export const condition = function () {
  return request.get('/houses/params')
}
// 发布房源
export const issueHouse = function (body) {
  return request.post('/user/houses', body)
}
export const addImg = function (fromDate) {
  return request.post('/houses/image', fromDate, {
    'Content-Type': 'multipart/form-data'
  })
}
